

#include <stdio.h>
#include <stdlib.h>
int isprime(int n);
int splitsum(int n);
int splitsqu(int n);
int main(int argc,char *argv[]){
    int n,sum,squ;
    for(n=100;n<=9999;n++){
        sum=splitsum(n);
        squ=splitsqu(n);
        if(isprime(n)==1&&isprime(sum)==1&&isprime(squ)==1)
            printf("%d is prime\n",n);
    }
    return 0;
        
}
int isprime(int n)
{
    int i;
    for(i=2;i<n;i++){
        if(n%i==0)
            break;
}
     if (i==n)
    return 1;
     return 0;
}
int splitsum(int n)
{
    int sum=0;
    while (n!=0) {
        sum+=n%10;
        n=n/10;
    }
        return sum;
}
    int splitsqu(int n)
    {
    int squ=0;
    while (n!=0) {
        squ+=(n%10)*(n%10);
        n=n/10;
    }
        return squ;

    }
